import { axios } from '@/utils/request'

const api = {
  categoryList: '/product/category/list',
  categoryTree: '/product/category/tree',
  categorySave: '/product/category/save',
  categoryUpdate: '/product/category/update',
  categoryDelete: '/product/category/delete',
  brandPage: '/product/brand/page',
  brandSave: '/product/brand/save',
  brandUpdate: '/product/brand/update',
  brandDelete: '/product/brand/delete',
  brandCategorys: '/product/brand/brandCategorys',
  brandByCategoryId: '/product/brand/brandByCategoryId',
  attributeList: '/product/attribute/list',
  attributeSave: '/product/attribute/save',
  attributeUpdate: '/product/attribute/update',
  attributeDelete: '/product/attribute/delete',
  attributeListByCatetoryId: '/product/attribute/listByCategoryId',
  spuSave: '/product/spu/save',
  spuUpdate: '/product/spu/update',
  spuPage: '/product/spu/page',
  spuVoGet: '/product/spu/getSpuVo',
  spuSaleableUpdate: '/product/spu/updateSaleable'
}
export default api

export function categoryTree (parameter) {
  return axios({
    url: api.categoryTree,
    method: 'get',
    params: parameter
  })
}

export function categoryList (parameter) {
  return axios({
    url: api.categoryList,
    method: 'get',
    params: parameter
  })
}

export function categorySave (parameter) {
  return axios({
    url: api.categorySave,
    method: 'post',
    data: parameter,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

export function categoryUpdate (parameter) {
  return axios({
    url: api.categoryUpdate,
    method: 'put',
    data: parameter,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

export function categoryDelete (parameter) {
  return axios({
    url: api.categoryDelete,
    method: 'delete',
    data: parameter,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

export function brandPage (parameter) {
  return axios({
    url: api.brandPage,
    method: 'get',
    params: parameter
  })
}

export function brandSave (parameter) {
  return axios({
    url: api.brandSave,
    method: 'post',
    data: parameter,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

export function brandUpdate (parameter) {
  return axios({
    url: api.brandUpdate,
    method: 'put',
    data: parameter,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}
export function brandDelete (parameter) {
  return axios({
    url: api.brandDelete,
    method: 'delete',
    data: parameter,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}
export function brandCategorys (parameter) {
  return axios({
    url: api.brandCategorys,
    method: 'get',
    params: parameter
  })
}

export function brandByCategoryId (parameter) {
  return axios({
    url: api.brandByCategoryId,
    method: 'get',
    params: parameter
  })
}

export function attributeList (parameter) {
  return axios({
    url: api.attributeList,
    method: 'get',
    params: parameter
  })
}

export function attributeListByCatetoryId (parameter) {
  return axios({
    url: api.attributeListByCatetoryId,
    method: 'get',
    params: parameter
  })
}

export function attributeSave (parameter) {
  return axios({
    url: api.attributeSave,
    method: 'post',
    data: parameter,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

export function attributeUpdate (parameter) {
  return axios({
    url: api.attributeUpdate,
    method: 'put',
    data: parameter,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}
export function attributeDelete (parameter) {
  return axios({
    url: api.attributeDelete,
    method: 'delete',
    data: parameter,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

export function spuSave (parameter) {
  return axios({
    url: api.spuSave,
    method: 'post',
    data: parameter,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

export function spuUpdate (parameter) {
  return axios({
    url: api.spuUpdate,
    method: 'post',
    data: parameter,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

export function spuPage (parameter) {
  return axios({
    url: api.spuPage,
    method: 'get',
    params: parameter
  })
}

export function spuVoGet (parameter) {
  return axios({
    url: api.spuVoGet,
    method: 'get',
    params: parameter
  })
}

export function spuSaleableUpdate (parameter) {
  return axios({
    url: api.spuSaleableUpdate,
    method: 'post',
    data: parameter,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}
